// Convert this program to C++
// change to C++ io
// change to one line comments
// change defines of constants to const
// change array to vector<>
// inline any short function

#include <iostream>
#include <vector>

using namespace std;

const int SIZE = 5;

// Inline function to calculate the sum of all elements
//+in a vector of summables and returning the sum
template <class summable>
inline summable sum(vector<summable> intVec)
{
	summable s = 0;
	for(int i = 0; i < intVec.size(); ++i) {
		s += intVec.at(i);
	}
	return s;
}

int main(void)
{
	int result = 0;
	// Create a vector of size SIZE of integers and zero-fill all its elements
	vector<int> intVector(SIZE, 0);
	// Assign integers 0 through SIZE to the vector elements
	for(int i = 0; i < intVector.size(); ++i) {
		intVector.at(i) = i;
	}

	result = sum<int>(intVector);
	cout << "Sum is: " << result << endl;

	return 0;
}
